package com.example.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
    //1.得到日志对象
    private static Logger log= LoggerFactory.getLogger(TestController.class);
    @Value("${string.value}")
    private String mykey;
    @RequestMapping("/hi")
    public String sayHi(){
        //2.使用日志对象提供的方法进行日志打印
        log.trace("Hi,trace");
        log.debug("Hi,debug");
        log.info("Hi,info");
        log.warn("Hi,warn");
        log.error("Hi,error");
        return mykey+" World";
    }
}
